package cn.ac.aircas.config.center.test.controller;

import cn.ac.aircas.config.center.test.config.TestConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;

/**
 * @author gaowenhao
 * @since 2021/9/23 09:19
 */
@RestController
public class ReadConfigController {


    @Autowired
    private TestConfig testConfig;


    @RequestMapping("/api/test/config/get")
    public Map<String, Object> getConfigVal() {
        Map<String, Object> res = new HashMap<>();
        res.put("fill-int", testConfig.getIntVal());
        res.put("fill-long", testConfig.getLongVal());
        res.put("fill-float", testConfig.getFloatVal());
        res.put("fill-double", testConfig.getDoubleVal());
        res.put("fill-str", testConfig.getStrVal());
        res.put("fill-bool", testConfig.getBoolVal());
        return res;
    }

}
